<template>
	<view class="page">
		<view class="record-list">
			<view class="list" v-for="(item,index) in dataList" :key="index" v-if="dataList.length!=0" style="padding-top: 20rpx;">
				<view class="title-date">
					<view class="title">
						<text>{{item.content}}</text>
					</view>
					<view class="date">
						<text>{{item.created_at}}</text>
					</view>
				</view>
				<view class="integral">
					<text>{{item.price}}</text>
				</view>
			</view>
			<view class="empty-box" v-if="dataList.length==0">
				<image src="/static/ic_nodata.png" mode=""></image>
				<view class="">暂无数据</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList:[],
				dataInfo:'',
				page:1,
				type:2
			};
			
		},
		onLoad(e) {
			if(e.type){
				this.type=e.type
			}
		},
		onShow() {
			let that = this
			that.page=1
			that.dataList=[]
			that.getList()
		},
		onReachBottom() {
			let that = this
			that.page++
			that.getList()
		},
		methods:{
			getList(){
				let that = this
				that.tui.request("api.auth.center/balanceList", "POST", {page:that.page,type:that.type}, false, false, true).then((res) => {
					if(res.code==1){
						that.dataList = that.dataList.concat(res.data.list)
					}
				}).catch((res) => {
					
				})
			},
			
			
		}
	}
</script>

<style scoped lang="scss">
	@import 'ConsumeRecord.scss';
</style>
